package com.asset.web.asset;

import com.asset.pojo.AssetDepreciation;
import com.asset.service.DepreciationService;
import com.asset.util.PageResult;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author 11725
 */
@RestController
@RequestMapping("/depreciation")
public class AssetDeprController {

    @Resource
    private DepreciationService deprService;

    /**
     * 分页查询
     * @param page  页码
     * @param rows  行数
     * @param month 按月份查询
     * @return 结果集
     */
    @GetMapping("list")
    public ResponseEntity<PageResult<AssetDepreciation>> selectByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "rows", defaultValue = "10") Integer rows,
            @RequestParam(value = "date", required = false) Date month
    ) {
        return ResponseEntity.ok(deprService.selectByPage(page, rows, month));
    }
}
